
inherit "obj/biota.c"


//执行
void heartbeat(){

    // scan();

}


 void scan(){
    chat();
 }


//随机走动
int randomMove(){

    map exits;
	string *dirs;

    if( !environment(this) ){
        println(toJsonStr(this));
        return 0;
    }

    if (! mapp(exits = environment(this).query("exits")) ) return 0;


    dirs = keys(exits);

	if ( sizeof(dirs)<=0 ) return 0;

    command(this,"go " + dirs[random(0,sizeof(dirs))]);

}

 int chat(){

    var chatMsgs = query("chatMsg");
    // varDump(this,random( 0,120 ),query("chatChance"));
    if( random( 0,120 ) < query("chatChance")) {
         foreach( cmsg in chatMsgs ){
               if( mapp(cmsg) ){
                   cmsg["fn"]();
               }
         }
    }

 }